<cfparam name="paymentID" type="integer">
<cfparam name="rv" type="string" default="payments">
<cfparam name="printable" type="string" default="false">

<cfset payment = application.paymentGateway.get(paymentID)>

<cfoutput>

	<cfif payment.getPayment_ID() gt 0>

		<cfset scholarship = application.scholarshipGateway.get(payment.getScholarship_ID())>
		<cfset paymentSchedule = application.paymentScheduleGateway.get(payment.getPayment_Schedule_ID())>
		<cfif IsNumeric(payment.getInstitution1_ID()) and payment.getInstitution1_ID() gt 0>
			<cfset institution1 = application.institutionGateway.get(payment.getInstitution1_ID())>
		</cfif>
		<cfif IsNumeric(payment.getInstitution2_ID()) and payment.getInstitution2_ID() gt 0>
			<cfset institution2 = application.institutionGateway.get(payment.getInstitution2_ID())>
		</cfif>
		<cfif IsNumeric(payment.getInstitution3_ID()) and payment.getInstitution3_ID() gt 0>
			<cfset institution3 = application.institutionGateway.get(payment.getInstitution3_ID())>
		</cfif>

		<cfset canEdit = true>

		<cfif NOT printable>
			<div class="buttonBar">
				<a href="#script_name#?view=#rv#&paymentID=#paymentID#&scholarshipID=#scholarshipID#" class="formLink2">Back</a>
				<cfif canEdit>
					<a href="#script_name#?view=editPayment&paymentID=#paymentID#&scholarshipID=#scholarshipID#" class="formLink">Edit</a>
				</cfif>
			</div>
		</cfif>

		<table class="panel">
			<thead>
				<tr>
					<th colspan="2">Payment Schedule</th>
				</tr>
			</thead>
			<tbody>
				<tr>
					<th>Cohort:</th>
					<td>#paymentSchedule.getCohort()#</td>
				</tr>
				<tr>
					<th>Scholarship Type:</th>
					<td>#paymentSchedule.getScholarship_Type()#</td>
				</tr>
				<tr>
					<th>Scheduled Amount:</th>
					<td>$#NumberFormat(paymentSchedule.getPayment_Amount())#</td>
				</tr>
				<tr>
					<th>Term:</th>
					<td>#paymentSchedule.getTerm()#</td>
				</tr>
				<tr>
					<th>Term Type:</th>
					<td>#paymentSchedule.getTerm_Type()#</td>
				</tr>
				<tr>
					<th>Verification Type:</th>
					<td>#paymentSchedule.getVerification_Type()#</td>
				</tr>
				<tr>
					<th>Required Document:</th>
					<td>
						<cfif paymentSchedule.getVerification_Type() eq "Enrollment">
							Class schedule
						<cfelseif paymentSchedule.getVerification_Type() eq "Performance">
							Transcript
						</cfif>
					</td>
				</tr>
				<tr>
					<th>Soft Deadline:</th>
					<td>
						<cfif IsDate(paymentSchedule.getVerification_Soft_Deadline())>
							#DateFormat(paymentSchedule.getVerification_Soft_Deadline(), "m/d/yyyy")#
						<cfelse>
							N/A
						</cfif>
					</td>
				</tr>
				<tr>
					<th>Hard Deadline:</th>
					<td>
						<cfif IsDate(paymentSchedule.getVerification_Hard_Deadline())>
							#DateFormat(paymentSchedule.getVerification_Hard_Deadline(), "m/d/yyyy")#
						<cfelse>
							N/A
						</cfif>
					</td>
				</tr>
			</tbody>
		</table>

		<table class="panel">
			<thead>
				<tr>
					<th colspan="2">Institution 1</th>
				</tr>
			</thead>
			<tbody>
				<tr>
					<th>Name:</th>
					<td>#institution1.getInstitution()#</td>
				</tr>
				<tr>
					<th>Document Date:</th>
					<td nowrap>#DateFormat(payment.getInstitution1_Document_Date(), 'm/d/yyyy')#</td>
				</tr>
				<cfif paymentSchedule.getVerification_Type() eq "Enrollment">
					<cfif scholarship.getPBS()>
						<tr>
							<th>Units:</th>
							<td nowrap>#payment.getInstitution1_Enrollment_Units()#</td>
						</tr>
					<cfelse>
						<tr>
							<th>Attendance Level:</th>
							<td nowrap>#payment.getInstitution1_Enrollment_Attendance_Level()#</td>
						</tr>
					</cfif>
					<tr>
						<th>Degree Level:</th>
						<td nowrap>#payment.getInstitution1_Enrollment_Degree_Level()#</td>
					</tr>
				<cfelseif paymentSchedule.getVerification_Type() eq "Performance">
					<tr>
						<th>Credits:</th>
						<td nowrap>#payment.getInstitution1_Performance_Credits()#</td>
					</tr>
					<tr>
						<th>GPA:</th>
						<td nowrap>#payment.getInstitution1_Performance_GPA()#</td>
					</tr>
				</cfif>
			</tbody>
		</table>

		<cfif IsNumeric(payment.getInstitution2_ID()) and payment.getInstitution2_ID() gt 0>
			<table class="panel">
				<thead>
					<tr>
						<th colspan="2">Institution 2</th>
					</tr>
				</thead>
				<tbody>
					<tr>
					<th>Name:</th>
					<td>#institution2.getInstitution()#</td>
				</tr>
				<tr>
					<th>Document Date:</th>
					<td nowrap>#DateFormat(payment.getInstitution2_Document_Date(), 'm/d/yyyy')#</td>
				</tr>
				<cfif paymentSchedule.getVerification_Type() eq "Enrollment">
					<cfif scholarship.getPBS()>
						<tr>
							<th>Units:</th>
							<td nowrap>#payment.getInstitution2_Enrollment_Units()#</td>
						</tr>
					<cfelse>
						<tr>
							<th>Attendance Level:</th>
							<td nowrap>#payment.getInstitution2_Enrollment_Attendance_Level()#</td>
						</tr>
					</cfif>
					<tr>
						<th>Degree Level:</th>
						<td nowrap>#payment.getInstitution2_Enrollment_Degree_Level()#</td>
					</tr>
				<cfelseif paymentSchedule.getVerification_Type() eq "Performance">
					<tr>
						<th>Credits:</th>
						<td nowrap>#payment.getInstitution2_Performance_Credits()#</td>
					</tr>
					<tr>
						<th>GPA:</th>
						<td nowrap>#payment.getInstitution2_Performance_GPA()#</td>
					</tr>
				</cfif>
				</tbody>
			</table>
		</cfif>

		<cfif IsNumeric(payment.getInstitution3_ID()) and payment.getInstitution3_ID() gt 0>
			<table class="panel">
				<thead>
					<tr>
						<th colspan="2">Institution 3</th>
					</tr>
				</thead>
				<tbody>
					<tr>
					<th>Name:</th>
					<td>#institution3.getInstitution()#</td>
				</tr>
				<tr>
					<th>Document Date:</th>
					<td nowrap>#DateFormat(payment.getInstitution3_Document_Date(), 'm/d/yyyy')#</td>
				</tr>
				<cfif paymentSchedule.getVerification_Type() eq "Enrollment">
					<cfif scholarship.getPBS()>
						<tr>
							<th>Units:</th>
							<td nowrap>#payment.getInstitution3_Enrollment_Units()#</td>
						</tr>
					<cfelse>
						<tr>
							<th>Attendance Level:</th>
							<td nowrap>#payment.getInstitution3_Enrollment_Attendance_Level()#</td>
						</tr>
					</cfif>
					<tr>
						<th>Degree Level:</th>
						<td nowrap>#payment.getInstitution3_Enrollment_Degree_Level()#</td>
					</tr>
				<cfelseif paymentSchedule.getVerification_Type() eq "Performance">
					<tr>
						<th>Credits:</th>
						<td nowrap>#payment.getInstitution3_Performance_Credits()#</td>
					</tr>
					<tr>
						<th>GPA:</th>
						<td nowrap>#payment.getInstitution3_Performance_GPA()#</td>
					</tr>
				</cfif>
				</tbody>
			</table>
		</cfif>

		<table class="panel">
			<thead>
				<tr>
					<th colspan="2">Payment</th>
				</tr>
			</thead>
			<tbody>
				<cfif paymentID gt 0>
					<tr>
						<th>Payment ID:</th>
						<td>#payment.getPayment_ID()#</td>
					</tr>
				</cfif>
				<tr>
					<th>No Payment:</th>
					<td>#YesNoFormat(payment.getOpt_Out())#</td>
				</tr>
				<cfif payment.getOpt_Out()>
					<tr>
						<th>Reason:</th>
						<td>#payment.getOpt_Out_Reason()#</td>
					</tr>
				</cfif>
				<tr>
					<th>Approval Date:</th>
					<td nowrap>#DateFormat(payment.getApproval_Date(), 'm/d/yyyy')#</td>
				</tr>
				<tr>
					<th>Submitted Date:</th>
					<td nowrap>#DateFormat(payment.getPayment_Submitted_Date(), 'm/d/yyyy')#</td>
				</tr>
				<tr>
					<th>Payment Date:</th>
					<td nowrap>#DateFormat(payment.getPayment_Date(), 'm/d/yyyy')#</td>
				</tr>
				<tr>
					<th>Payment Type:</th>
					<td nowrap>#payment.getPayment_Type()#</td>
				</tr>
				<tr>
					<th>Amount:</th>
					<td nowrap>
					<cfif IsNumeric(payment.getPayment_Amount())>
						$#NumberFormat(payment.getPayment_Amount())#
					</cfif>
				</td>
				</tr>
				<tr>
					<th>Payment Reference:</th>
					<td nowrap>#payment.getPayment_Reference()#</td>
				</tr>
				<tr>
					<th>Notes:</th>
					<td nowrap>#payment.getNotes()#</td>
				</tr>
			</tbody>
		</table>

		<cfif printable>
			<table width="420">
				<tr>
					<td colspan="2">&nbsp;<br></td>
				</tr>
				<tr>
					<td nowrap="nowrap">Approved By:</td>
					<td style="border-bottom: solid 1px black;" width="100%">&nbsp;<br></td>
				</tr>
				<tr>
					<td colspan="2">&nbsp;<br>&nbsp;<br></td>
				</tr>
				<tr>
					<td nowrap="nowrap">Approval Date:</td>
					<td style="border-bottom: solid 1px black;" width="100%">&nbsp;<br></td>
				</tr>
			</table>

			<p><font style="font-size: 10px;">Printed #DateFormat(now(), "m/d/yyyy")# #TimeFormat(now(), "h:mmtt")#</font></p>
			<cfabort>
		</cfif>

		<!--- <table class="detail">
			<tr>
				<th colspan="2">Payment</th>
			</tr>
			<tr>
				<td>
					<cfif paymentID gt 0>
						Payment ID: #payment.getPayment_ID()#<br>
					</cfif>

				</td>
			</tr>
		</table>

		<cfif (IsUserInRole("Super User") or IsUserInRole("Regional Admin")) and m neq "orderDetailSendEdFundEmail">
			<div>
				<cfinclude template="#request.pathToUI#/details/organization.cfm">
			</div>
		</cfif>

		<table class="detail">
			<tr>
				<th>Shipping Information</th>
			</tr>
			<tr>
				<td>
					<cfif Len(Trim(order.getShipping_Organization())) gt 0>
						#order.getShipping_Organization()#<br>
					</cfif>
					#order.getShipping_Name()#<br>
					#order.getShipping_Address()#<br>
					#order.getShipping_City()#, CA #order.getShipping_Zip_Code()#<br>
					#order.getShipping_Phone()#
					<cfif Len(Trim(order.getShipping_Instructions())) gt 0>
						<br><br><u>Shipping Instructions</u><br>
						#order.getShipping_Instructions()#
					</cfif>
				</td>
			</tr>
		</table> --->

	<cfelse>

		<div class="alert alert-info notFound">Payment not found</div>

	</cfif>

</cfoutput>
